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

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

g = A("g")
i = B("i")
e = A("e")
c = B("c")
f = A("f")
k = B("k")
b = A("b")
h = A("h")
l = A("l")
j = B("j")

g.x = l
g.p = e
i.t = h
i.v = j
e.x = g
e.p = g
c.t = h
c.v = i
f.x = b
f.p = g
k.t = e
k.v = i
b.x = l
b.p = f
h.x = f
h.p = e
l.x = f
l.p = b
j.t = g
j.v = k
assert j.t.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.p: A = None
        self.txt = txt

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

g = A("g")
i = B("i")
e = A("e")
c = B("c")
f = A("f")
k = B("k")
b = A("b")
h = A("h")
l = A("l")
j = B("j")

g.x = l
g.p = e
i.t = h
i.v = j
e.x = g
e.p = g
c.t = h
c.v = i
f.x = b
f.p = g
k.t = e
k.v = i
b.x = l
b.p = f
h.x = f
h.p = e
l.x = f
l.p = b
j.t = g
j.v = k
assert j.t.x.x.x.txt == "b"