class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: B = None
        self.o: D = None
        self.u: A = None
        self.y: G = None
        self.t: F = None
        self.z: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: G = None
        self.x: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.z: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: D = None
        self.v: E = None
        self.r: G = None
        self.x: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: E = None
        self.t: A = None
        self.q: F = None
        self.txt = txt

g = A("g")
a = B("a")
e = C("e")
b = D("b")
f = E("f")
c = F("c")
k = G("k")
m = D("m")
d = A("d")
n = C("n")

g.p = a
g.q = a
g.o = b
g.u = d
g.y = k
g.t = c
g.z = c
a.z = k
a.x = m
e.y = f
e.z = m
b.p = d
f.t = m
f.v = b
c.y = e
c.q = m
c.v = f
c.r = k
c.x = b
k.y = f
k.t = d
k.q = c
m.p = d
d.p = a
d.q = a
d.o = b
d.u = g
d.y = k
d.t = c
d.z = c
n.y = f
n.z = b
assert g.t.v.t.p.q.x.p.o.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: B = None
        self.o: D = None
        self.u: A = None
        self.y: G = None
        self.t: F = None
        self.z: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: G = None
        self.x: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.z: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: D = None
        self.v: E = None
        self.r: G = None
        self.x: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: E = None
        self.t: A = None
        self.q: F = None
        self.txt = txt

g = A("g")
a = B("a")
e = C("e")
b = D("b")
f = E("f")
c = F("c")
k = G("k")
m = D("m")
d = A("d")
n = C("n")

g.p = a
g.q = a
g.o = b
g.u = d
g.y = k
g.t = c
g.z = c
a.z = k
a.x = m
e.y = f
e.z = m
b.p = d
f.t = m
f.v = b
c.y = e
c.q = m
c.v = f
c.r = k
c.x = b
k.y = f
k.t = d
k.q = c
m.p = d
d.p = a
d.q = a
d.o = b
d.u = g
d.y = k
d.t = c
d.z = c
n.y = f
n.z = b
assert g.t.v.t.p.q.x.p.o.p.y.txt == "k"