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

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

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

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

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

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

c = A("c")
n = B("n")
b = C("b")
f = D("f")
l = E("l")
m = F("m")
e = E("e")

c.q = n
n.p = m
b.z = l
f.s = e
f.z = l
l.x = n
l.p = b
l.t = e
l.q = c
l.v = c
l.z = m
m.w = b
e.x = n
e.p = b
e.t = l
e.q = c
e.v = c
e.z = m
assert b.z.t.p.z.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

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

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

c = A("c")
n = B("n")
b = C("b")
f = D("f")
l = E("l")
m = F("m")
e = E("e")

c.q = n
n.p = m
b.z = l
f.s = e
f.z = l
l.x = n
l.p = b
l.t = e
l.q = c
l.v = c
l.z = m
m.w = b
e.x = n
e.p = b
e.t = l
e.q = c
e.v = c
e.z = m
assert b.z.t.p.z.q.q.txt == "n"