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

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

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

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

l = A("l")
d = B("d")
k = C("k")
f = D("f")
a = C("a")
i = D("i")
h = A("h")

l.y = a
l.w = d
d.y = f
d.w = l
d.v = a
k.u = h
k.z = d
k.q = a
f.z = a
f.r = l
f.v = i
f.o = k
a.u = h
a.z = d
a.q = k
i.z = k
i.r = h
i.v = f
i.o = a
h.y = k
h.w = d
assert f.v.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: B = None
        self.txt = txt

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

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

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

l = A("l")
d = B("d")
k = C("k")
f = D("f")
a = C("a")
i = D("i")
h = A("h")

l.y = a
l.w = d
d.y = f
d.w = l
d.v = a
k.u = h
k.z = d
k.q = a
f.z = a
f.r = l
f.v = i
f.o = k
a.u = h
a.z = d
a.q = k
i.z = k
i.r = h
i.v = f
i.o = a
h.y = k
h.w = d
assert f.v.o.u.txt == "h"