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

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: B = None
        self.txt = txt

l = A("l")
n = B("n")
m = C("m")
f = D("f")
d = B("d")
b = C("b")
h = B("h")
k = A("k")

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: B = None
        self.txt = txt

l = A("l")
n = B("n")
m = C("m")
f = D("f")
d = B("d")
b = C("b")
h = B("h")
k = A("k")

l.x = d
l.u = m
l.v = m
l.y = f
n.w = l
m.q = l
m.o = l
m.y = b
f.t = d
f.o = h
d.w = k
b.q = k
b.o = k
b.y = m
h.w = l
k.x = d
k.u = m
k.v = b
k.y = f
assert f.o.w.y.t.w.u.txt == "m"