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

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

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

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

d = A("d")
k = B("k")
b = C("b")
c = D("c")
n = B("n")
l = D("l")
f = D("f")
j = B("j")
g = D("g")

d.z = f
d.o = k
d.p = j
k.v = n
k.u = n
k.o = d
k.x = d
b.u = n
c.s = f
c.q = n
n.v = k
n.o = d
n.x = d
n.u = j
l.s = f
l.q = j
f.s = l
f.q = n
j.v = n
j.o = d
j.x = d
j.u = k
g.s = f
g.q = j
assert b.u.u.o.p.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: B = None
        self.p: B = None
        self.txt = txt

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

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

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

d = A("d")
k = B("k")
b = C("b")
c = D("c")
n = B("n")
l = D("l")
f = D("f")
j = B("j")
g = D("g")

d.z = f
d.o = k
d.p = j
k.v = n
k.u = n
k.o = d
k.x = d
b.u = n
c.s = f
c.q = n
n.v = k
n.o = d
n.x = d
n.u = j
l.s = f
l.q = j
f.s = l
f.q = n
j.v = n
j.o = d
j.x = d
j.u = k
g.s = f
g.q = j
assert b.u.u.o.p.x.o.txt == "k"