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

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

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

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

b.r = c
b.p = j
b.u = d
c.y = j
c.x = e
c.t = e
j.q = i
j.u = e
d.r = i
d.p = j
d.u = b
e.y = j
e.x = i
e.t = c
i.y = j
i.x = e
i.t = c
assert j.q.y.u.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: C = None
        self.u: A = None
        self.txt = txt

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

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

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

b.r = c
b.p = j
b.u = d
c.y = j
c.x = e
c.t = e
j.q = i
j.u = e
d.r = i
d.p = j
d.u = b
e.y = j
e.x = i
e.t = c
i.y = j
i.x = e
i.t = c
assert j.q.y.u.y.q.txt == "i"