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

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

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

i.v = f
i.p = d
e.u = d
e.t = f
b.v = f
b.p = d
a.v = f
a.p = e
f.v = j
f.p = d
h.v = f
h.p = d
d.u = e
d.t = f
j.v = h
j.p = d
assert e.t.p.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: B = None
        self.txt = txt

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

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

i.v = f
i.p = d
e.u = d
e.t = f
b.v = f
b.p = d
a.v = f
a.p = e
f.v = j
f.p = d
h.v = f
h.p = d
d.u = e
d.t = f
j.v = h
j.p = d
assert e.t.p.u.u.txt == "d"