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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: A = None
        self.p: C = None
        self.txt = txt

j = A("j")
d = B("d")
g = C("g")
c = D("c")
b = D("b")
f = D("f")
h = B("h")
i = A("i")
n = C("n")

j.z = h
j.o = h
j.u = i
d.v = i
d.z = h
d.o = h
d.w = c
g.z = j
g.v = b
g.q = i
c.t = g
c.y = i
c.p = n
b.t = g
b.y = j
b.p = n
f.t = g
f.y = j
f.p = n
h.v = j
h.z = d
h.o = d
h.w = f
i.z = h
i.o = h
i.u = j
n.z = i
n.v = f
n.q = j
assert b.p.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: A = None
        self.o: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: A = None
        self.p: C = None
        self.txt = txt

j = A("j")
d = B("d")
g = C("g")
c = D("c")
b = D("b")
f = D("f")
h = B("h")
i = A("i")
n = C("n")

j.z = h
j.o = h
j.u = i
d.v = i
d.z = h
d.o = h
d.w = c
g.z = j
g.v = b
g.q = i
c.t = g
c.y = i
c.p = n
b.t = g
b.y = j
b.p = n
f.t = g
f.y = j
f.p = n
h.v = j
h.z = d
h.o = d
h.w = f
i.z = h
i.o = h
i.u = j
n.z = i
n.v = f
n.q = j
assert b.p.v.t.txt == "g"