class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: B = None
        self.v: B = None
        self.r: B = None
        self.o: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: D = None
        self.r: F = None
        self.v: A = None
        self.w: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: B = None
        self.z: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

d.q = c
d.t = b
d.v = b
d.r = k
d.o = k
k.x = c
k.t = b
k.z = g
m.s = k
m.q = g
m.r = a
m.v = d
m.w = c
g.o = c
c.x = m
c.p = b
c.z = d
a.z = c
b.x = c
b.t = k
b.z = g
assert b.x.p.t.z.o.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: B = None
        self.v: B = None
        self.r: B = None
        self.o: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: D = None
        self.r: F = None
        self.v: A = None
        self.w: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: B = None
        self.z: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

d.q = c
d.t = b
d.v = b
d.r = k
d.o = k
k.x = c
k.t = b
k.z = g
m.s = k
m.q = g
m.r = a
m.v = d
m.w = c
g.o = c
c.x = m
c.p = b
c.z = d
a.z = c
b.x = c
b.t = k
b.z = g
assert b.x.p.t.z.o.p.z.txt == "g"