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

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

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

b = A("b")
n = B("n")
c = C("c")
a = B("a")
i = A("i")
e = B("e")
g = B("g")
d = C("d")
j = B("j")
h = C("h")

b.u = c
b.r = i
n.u = b
n.y = e
n.z = c
c.u = i
c.t = g
c.v = j
a.u = i
a.y = g
a.z = c
i.u = d
i.r = b
e.u = i
e.y = a
e.z = h
g.u = b
g.y = j
g.z = d
d.u = b
d.t = j
d.v = a
j.u = i
j.y = e
j.z = d
h.u = i
h.t = g
h.v = j
assert j.y.z.t.y.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: A = None
        self.txt = txt

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

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

b = A("b")
n = B("n")
c = C("c")
a = B("a")
i = A("i")
e = B("e")
g = B("g")
d = C("d")
j = B("j")
h = C("h")

b.u = c
b.r = i
n.u = b
n.y = e
n.z = c
c.u = i
c.t = g
c.v = j
a.u = i
a.y = g
a.z = c
i.u = d
i.r = b
e.u = i
e.y = a
e.z = h
g.u = b
g.y = j
g.z = d
d.u = b
d.t = j
d.v = a
j.u = i
j.y = e
j.z = d
h.u = i
h.t = g
h.v = j
assert j.y.z.t.y.u.u.u.u.txt == "c"