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

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

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

c = A("c")
f = B("f")
j = C("j")
k = B("k")
l = B("l")
i = C("i")
e = B("e")

c.u = j
c.v = i
f.u = l
j.z = c
j.y = c
k.u = e
l.u = e
i.z = c
i.y = c
e.u = k
assert i.z.v.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.v: C = None
        self.txt = txt

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

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

c = A("c")
f = B("f")
j = C("j")
k = B("k")
l = B("l")
i = C("i")
e = B("e")

c.u = j
c.v = i
f.u = l
j.z = c
j.y = c
k.u = e
l.u = e
i.z = c
i.y = c
e.u = k
assert i.z.v.z.u.txt == "j"