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

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

class C:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: A = None
        self.txt = txt

b = A("b")
d = B("d")
i = C("i")
e = B("e")
a = C("a")
c = C("c")
k = A("k")
n = B("n")
j = C("j")

b.y = j
d.t = j
d.r = i
i.r = c
i.x = k
e.t = j
e.r = c
a.r = i
a.x = k
c.r = i
c.x = b
k.y = j
n.t = a
n.r = c
j.r = i
j.x = b
assert c.x.y.x.y.x.y.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: A = None
        self.txt = txt

b = A("b")
d = B("d")
i = C("i")
e = B("e")
a = C("a")
c = C("c")
k = A("k")
n = B("n")
j = C("j")

b.y = j
d.t = j
d.r = i
i.r = c
i.x = k
e.t = j
e.r = c
a.r = i
a.x = k
c.r = i
c.x = b
k.y = j
n.t = a
n.r = c
j.r = i
j.x = b
assert c.x.y.x.y.x.y.x.y.txt == "j"