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

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

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

k = A("k")
j = B("j")
b = C("b")
e = A("e")
a = C("a")
d = B("d")
c = A("c")
h = A("h")
i = A("i")
l = C("l")

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

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

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

k = A("k")
j = B("j")
b = C("b")
e = A("e")
a = C("a")
d = B("d")
c = A("c")
h = A("h")
i = A("i")
l = C("l")

k.x = a
k.u = d
j.r = c
j.p = d
b.v = d
b.y = l
b.r = l
e.x = l
e.u = j
a.v = d
a.y = l
a.r = b
d.r = e
d.p = j
c.x = b
c.u = j
h.x = l
h.u = d
i.x = a
i.u = j
l.v = j
l.y = b
l.r = b
assert j.r.x.v.r.u.r.txt == "c"