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

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

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

h = A("h")
l = B("l")
g = C("g")
j = B("j")
a = C("a")
f = A("f")
b = A("b")
n = B("n")
k = A("k")

h.r = a
l.y = n
l.u = b
g.t = j
g.q = a
j.y = n
j.u = h
a.t = n
a.q = g
f.r = a
b.r = g
n.y = j
n.u = h
k.r = g
assert a.t.y.u.r.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

h = A("h")
l = B("l")
g = C("g")
j = B("j")
a = C("a")
f = A("f")
b = A("b")
n = B("n")
k = A("k")

h.r = a
l.y = n
l.u = b
g.t = j
g.q = a
j.y = n
j.u = h
a.t = n
a.q = g
f.r = a
b.r = g
n.y = j
n.u = h
k.r = g
assert a.t.y.u.r.t.y.txt == "j"