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

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

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

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

i = A("i")
l = B("l")
d = C("d")
n = D("n")
b = C("b")
f = B("f")
m = B("m")
g = D("g")

i.x = n
l.p = b
l.u = i
l.s = g
d.v = i
d.p = i
d.z = n
d.r = f
n.u = i
n.q = b
n.z = l
b.v = i
b.p = i
b.z = g
b.r = m
f.p = b
f.u = i
f.s = n
m.p = b
m.u = i
m.s = n
g.u = i
g.q = b
g.z = m
assert n.q.p.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

i = A("i")
l = B("l")
d = C("d")
n = D("n")
b = C("b")
f = B("f")
m = B("m")
g = D("g")

i.x = n
l.p = b
l.u = i
l.s = g
d.v = i
d.p = i
d.z = n
d.r = f
n.u = i
n.q = b
n.z = l
b.v = i
b.p = i
b.z = g
b.r = m
f.p = b
f.u = i
f.s = n
m.p = b
m.u = i
m.s = n
g.u = i
g.q = b
g.z = m
assert n.q.p.x.u.txt == "i"