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

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: B = None
        self.s: C = None
        self.txt = txt

b = A("b")
h = B("h")
e = C("e")
m = B("m")
k = C("k")
c = C("c")
l = B("l")
d = A("d")

b.q = d
b.p = m
b.w = m
h.z = d
h.q = d
h.v = e
e.p = c
e.s = c
e.y = l
m.z = d
m.q = b
m.v = e
k.p = c
k.y = m
k.s = e
c.p = k
c.y = h
c.s = e
l.z = d
l.q = b
l.v = c
d.q = b
d.p = m
d.w = l
assert e.y.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: B = None
        self.w: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: B = None
        self.s: C = None
        self.txt = txt

b = A("b")
h = B("h")
e = C("e")
m = B("m")
k = C("k")
c = C("c")
l = B("l")
d = A("d")

b.q = d
b.p = m
b.w = m
h.z = d
h.q = d
h.v = e
e.p = c
e.s = c
e.y = l
m.z = d
m.q = b
m.v = e
k.p = c
k.y = m
k.s = e
c.p = k
c.y = h
c.s = e
l.z = d
l.q = b
l.v = c
d.q = b
d.p = m
d.w = l
assert e.y.z.q.txt == "b"