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

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

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

i = A("i")
j = B("j")
k = C("k")
d = B("d")
g = B("g")
n = A("n")
c = B("c")
f = B("f")
m = A("m")

i.t = k
i.r = j
i.x = m
j.p = f
j.x = i
j.u = g
k.v = n
k.s = n
d.p = j
d.x = i
d.u = c
g.p = d
g.x = n
g.u = f
n.t = k
n.r = d
n.x = m
c.p = d
c.x = n
c.u = g
f.p = c
f.x = i
f.u = j
m.t = k
m.r = f
m.x = i
assert g.u.p.p.u.p.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: B = None
        self.x: A = None
        self.txt = txt

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

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

i = A("i")
j = B("j")
k = C("k")
d = B("d")
g = B("g")
n = A("n")
c = B("c")
f = B("f")
m = A("m")

i.t = k
i.r = j
i.x = m
j.p = f
j.x = i
j.u = g
k.v = n
k.s = n
d.p = j
d.x = i
d.u = c
g.p = d
g.x = n
g.u = f
n.t = k
n.r = d
n.x = m
c.p = d
c.x = n
c.u = g
f.p = c
f.x = i
f.u = j
m.t = k
m.r = f
m.x = i
assert g.u.p.p.u.p.u.x.txt == "n"