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

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

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

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

c = A("c")
h = B("h")
m = C("m")
e = D("e")
k = B("k")
n = B("n")
f = D("f")
l = C("l")
g = B("g")
d = A("d")

c.z = m
c.x = d
c.u = h
h.o = e
m.v = l
m.s = f
m.q = c
e.r = f
k.o = e
n.o = f
f.r = e
l.v = m
l.s = e
l.q = d
g.o = f
d.z = m
d.x = c
d.u = h
assert k.o.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: A = None
        self.u: B = None
        self.txt = txt

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

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

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

c = A("c")
h = B("h")
m = C("m")
e = D("e")
k = B("k")
n = B("n")
f = D("f")
l = C("l")
g = B("g")
d = A("d")

c.z = m
c.x = d
c.u = h
h.o = e
m.v = l
m.s = f
m.q = c
e.r = f
k.o = e
n.o = f
f.r = e
l.v = m
l.s = e
l.q = d
g.o = f
d.z = m
d.x = c
d.u = h
assert k.o.r.r.txt == "e"