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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.q: B = None
        self.txt = txt

b = A("b")
j = B("j")
a = C("a")
d = B("d")
g = C("g")
i = C("i")
k = C("k")
l = C("l")
h = A("h")
m = A("m")

b.v = k
b.t = a
j.y = d
j.u = h
a.x = b
a.q = j
d.y = j
d.u = h
g.x = h
g.q = d
i.x = b
i.q = j
k.x = h
k.q = j
l.x = b
l.q = d
h.v = a
h.t = l
m.v = k
m.t = l
assert d.u.v.x.v.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.q: B = None
        self.txt = txt

b = A("b")
j = B("j")
a = C("a")
d = B("d")
g = C("g")
i = C("i")
k = C("k")
l = C("l")
h = A("h")
m = A("m")

b.v = k
b.t = a
j.y = d
j.u = h
a.x = b
a.q = j
d.y = j
d.u = h
g.x = h
g.q = d
i.x = b
i.q = j
k.x = h
k.q = j
l.x = b
l.q = d
h.v = a
h.t = l
m.v = k
m.t = l
assert d.u.v.x.v.x.v.txt == "a"