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

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

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

b = A("b")
g = B("g")
k = C("k")
d = C("d")
m = A("m")
e = B("e")
c = A("c")
n = A("n")

b.t = g
b.r = m
g.s = k
g.v = d
k.z = d
k.t = d
k.o = d
d.z = k
d.t = k
d.o = k
m.t = g
m.r = b
e.s = k
e.v = k
c.t = g
c.r = m
n.t = e
n.r = c
assert b.t.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: A = None
        self.txt = txt

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

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

b = A("b")
g = B("g")
k = C("k")
d = C("d")
m = A("m")
e = B("e")
c = A("c")
n = A("n")

b.t = g
b.r = m
g.s = k
g.v = d
k.z = d
k.t = d
k.o = d
d.z = k
d.t = k
d.o = k
m.t = g
m.r = b
e.s = k
e.v = k
c.t = g
c.r = m
n.t = e
n.r = c
assert b.t.s.o.txt == "d"