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

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

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

b = A("b")
c = B("c")
k = C("k")
i = A("i")
f = B("f")
n = C("n")
h = B("h")
l = B("l")
d = B("d")
e = C("e")

b.r = k
b.p = d
b.y = i
c.u = b
k.q = f
i.r = e
i.p = d
i.y = b
f.u = i
n.q = h
h.u = i
l.u = i
d.u = b
e.q = f
assert c.u.r.q.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: B = None
        self.y: A = None
        self.txt = txt

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

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

b = A("b")
c = B("c")
k = C("k")
i = A("i")
f = B("f")
n = C("n")
h = B("h")
l = B("l")
d = B("d")
e = C("e")

b.r = k
b.p = d
b.y = i
c.u = b
k.q = f
i.r = e
i.p = d
i.y = b
f.u = i
n.q = h
h.u = i
l.u = i
d.u = b
e.q = f
assert c.u.r.q.u.y.txt == "b"