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

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

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

l = A("l")
h = B("h")
c = C("c")
g = B("g")
j = B("j")
b = C("b")
d = C("d")

l.v = g
l.w = b
l.p = c
h.t = g
h.z = j
h.p = c
c.t = d
c.q = d
c.s = b
g.t = h
g.z = j
g.p = d
j.t = h
j.z = h
j.p = c
b.t = d
b.s = d
b.q = c
d.t = b
d.q = b
d.s = c
assert b.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: C = None
        self.p: C = None
        self.txt = txt

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

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

l = A("l")
h = B("h")
c = C("c")
g = B("g")
j = B("j")
b = C("b")
d = C("d")

l.v = g
l.w = b
l.p = c
h.t = g
h.z = j
h.p = c
c.t = d
c.q = d
c.s = b
g.t = h
g.z = j
g.p = d
j.t = h
j.z = h
j.p = c
b.t = d
b.s = d
b.q = c
d.t = b
d.q = b
d.s = c
assert b.s.s.s.txt == "b"