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

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

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

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

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

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

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

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

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