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

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

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

j = A("j")
e = B("e")
g = C("g")
c = C("c")
a = B("a")
k = A("k")
h = B("h")
f = B("f")

j.u = h
j.r = c
j.p = k
e.t = h
g.z = c
g.x = k
g.t = f
c.z = g
c.x = k
c.t = e
a.t = e
k.u = f
k.r = c
k.p = j
h.t = a
f.t = e
assert e.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: C = None
        self.p: A = None
        self.txt = txt

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

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

j = A("j")
e = B("e")
g = C("g")
c = C("c")
a = B("a")
k = A("k")
h = B("h")
f = B("f")

j.u = h
j.r = c
j.p = k
e.t = h
g.z = c
g.x = k
g.t = f
c.z = g
c.x = k
c.t = e
a.t = e
k.u = f
k.r = c
k.p = j
h.t = a
f.t = e
assert e.t.t.t.t.txt == "h"