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

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

class C:
    def __init__(self, txt: str):
        self.r: C = None
        self.q: D = None
        self.txt = txt

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

h = A("h")
b = B("b")
m = C("m")
g = D("g")
l = A("l")
j = C("j")
a = D("a")

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

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

class C:
    def __init__(self, txt: str):
        self.r: C = None
        self.q: D = None
        self.txt = txt

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

h = A("h")
b = B("b")
m = C("m")
g = D("g")
l = A("l")
j = C("j")
a = D("a")

h.u = m
h.y = j
b.t = l
b.s = l
b.q = m
m.r = j
m.q = g
g.z = l
g.v = a
g.r = a
g.u = b
l.u = j
l.y = m
j.r = m
j.q = a
a.z = l
a.v = g
a.r = g
a.u = b
assert a.r.v.u.s.txt == "l"