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

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

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: D = None
        self.txt = txt

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

l = A("l")
d = B("d")
m = C("m")
j = D("j")
g = D("g")
a = D("a")
h = D("h")
k = B("k")
f = C("f")

l.u = m
l.o = m
l.s = d
d.v = l
d.t = k
d.w = k
d.q = f
m.y = f
m.o = a
j.v = a
j.x = a
j.r = m
g.v = j
g.x = h
g.r = m
a.v = j
a.x = j
a.r = m
h.v = a
h.x = j
h.r = m
k.v = l
k.t = d
k.w = d
k.q = f
f.y = m
f.o = g
assert l.s.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: C = None
        self.s: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: D = None
        self.txt = txt

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

l = A("l")
d = B("d")
m = C("m")
j = D("j")
g = D("g")
a = D("a")
h = D("h")
k = B("k")
f = C("f")

l.u = m
l.o = m
l.s = d
d.v = l
d.t = k
d.w = k
d.q = f
m.y = f
m.o = a
j.v = a
j.x = a
j.r = m
g.v = j
g.x = h
g.r = m
a.v = j
a.x = j
a.r = m
h.v = a
h.x = j
h.r = m
k.v = l
k.t = d
k.w = d
k.q = f
f.y = m
f.o = g
assert l.s.q.y.txt == "m"