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

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

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

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

j = A("j")
h = B("h")
k = C("k")
i = D("i")
c = D("c")
f = A("f")
m = B("m")
l = C("l")
d = A("d")

j.u = h
j.z = k
j.x = k
j.y = f
h.u = j
h.y = k
k.y = l
k.p = l
k.x = j
k.v = m
i.x = k
i.t = k
i.o = l
c.x = k
c.o = k
c.t = l
f.u = m
f.z = l
f.x = k
f.y = d
m.u = d
m.y = k
l.y = k
l.p = k
l.x = f
l.v = h
d.u = h
d.z = k
d.x = k
d.y = f
assert f.y.y.y.x.x.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: C = None
        self.x: C = None
        self.y: A = None
        self.txt = txt

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

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

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

j = A("j")
h = B("h")
k = C("k")
i = D("i")
c = D("c")
f = A("f")
m = B("m")
l = C("l")
d = A("d")

j.u = h
j.z = k
j.x = k
j.y = f
h.u = j
h.y = k
k.y = l
k.p = l
k.x = j
k.v = m
i.x = k
i.t = k
i.o = l
c.x = k
c.o = k
c.t = l
f.u = m
f.z = l
f.x = k
f.y = d
m.u = d
m.y = k
l.y = k
l.p = k
l.x = f
l.v = h
d.u = h
d.z = k
d.x = k
d.y = f
assert f.y.y.y.x.x.y.x.txt == "k"