class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.o: F = None
        self.w: D = None
        self.y: D = None
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: F = None
        self.r: A = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: B = None
        self.u: B = None
        self.p: C = None
        self.s: B = None
        self.o: F = None
        self.txt = txt

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

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

g = A("g")
c = B("c")
b = C("b")
e = D("e")
n = E("n")
d = F("d")

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

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: F = None
        self.r: A = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: B = None
        self.u: B = None
        self.p: C = None
        self.s: B = None
        self.o: F = None
        self.txt = txt

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

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

g = A("g")
c = B("c")
b = C("b")
e = D("e")
n = E("n")
d = F("d")

g.p = d
g.o = d
g.w = e
g.y = e
g.z = e
c.y = b
c.t = d
c.r = g
c.p = e
b.o = c
e.q = g
e.v = c
e.u = c
e.s = c
e.p = b
e.o = d
n.q = g
n.x = c
d.z = c
assert n.q.o.z.t.z.txt == "c"