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

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

c = A("c")
d = B("d")
i = A("i")
l = B("l")
a = B("a")
n = A("n")
m = A("m")
g = A("g")
k = A("k")
f = A("f")

c.v = a
d.u = a
d.x = l
i.v = l
l.u = d
l.x = a
a.u = l
a.x = d
n.v = d
m.v = l
g.v = l
k.v = d
f.v = l
assert l.x.x.x.u.u.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

c = A("c")
d = B("d")
i = A("i")
l = B("l")
a = B("a")
n = A("n")
m = A("m")
g = A("g")
k = A("k")
f = A("f")

c.v = a
d.u = a
d.x = l
i.v = l
l.u = d
l.x = a
a.u = l
a.x = d
n.v = d
m.v = l
g.v = l
k.v = d
f.v = l
assert l.x.x.x.u.u.x.u.txt == "a"