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

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

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

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

b.y = d
m.z = n
m.y = j
f.p = k
f.t = d
f.v = j
d.y = b
g.y = d
c.p = k
c.t = b
c.v = f
n.z = m
n.y = k
j.p = c
j.v = c
j.t = b
k.p = f
k.v = f
k.t = b
assert c.t.y.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

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

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

b.y = d
m.z = n
m.y = j
f.p = k
f.t = d
f.v = j
d.y = b
g.y = d
c.p = k
c.t = b
c.v = f
n.z = m
n.y = k
j.p = c
j.v = c
j.t = b
k.p = f
k.v = f
k.t = b
assert c.t.y.y.y.y.y.y.y.txt == "d"