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

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

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

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

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

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

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