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

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

c = A("c")
e = B("e")
n = A("n")
i = B("i")
f = A("f")
m = B("m")
b = A("b")
a = B("a")
j = A("j")
h = B("h")

c.x = n
c.u = n
e.r = i
e.x = m
n.x = c
n.u = j
i.r = m
i.x = e
f.x = b
f.u = b
m.r = h
m.x = a
b.x = j
b.u = f
a.r = h
a.x = e
j.x = n
j.u = n
h.r = m
h.x = i
assert h.r.r.x.x.r.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: A = None
        self.txt = txt

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

c = A("c")
e = B("e")
n = A("n")
i = B("i")
f = A("f")
m = B("m")
b = A("b")
a = B("a")
j = A("j")
h = B("h")

c.x = n
c.u = n
e.r = i
e.x = m
n.x = c
n.u = j
i.r = m
i.x = e
f.x = b
f.u = b
m.r = h
m.x = a
b.x = j
b.u = f
a.r = h
a.x = e
j.x = n
j.u = n
h.r = m
h.x = i
assert h.r.r.x.x.r.r.x.txt == "a"