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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.w: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.w: B = None
        self.z: E = None
        self.v: B = None
        self.r: B = None
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: E = None
        self.v: C = None
        self.s: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.w: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.w: B = None
        self.z: E = None
        self.v: B = None
        self.r: B = None
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: E = None
        self.v: C = None
        self.s: A = None
        self.txt = txt

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

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