class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: A = None
        self.p: C = None
        self.o: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: B = None
        self.q: B = None
        self.t: C = None
        self.txt = txt

e = A("e")
d = B("d")
i = C("i")
f = D("f")
n = A("n")
g = B("g")
j = A("j")
k = D("k")

e.x = i
e.p = i
e.r = n
e.o = j
d.u = k
d.v = k
d.s = g
d.z = i
i.q = n
f.w = k
f.p = d
f.q = d
f.t = i
n.x = i
n.p = i
n.r = e
n.o = j
g.u = k
g.v = f
g.s = d
g.z = i
j.x = i
j.p = i
j.r = n
j.o = e
k.w = f
k.p = d
k.q = d
k.t = i
assert j.r.p.q.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: A = None
        self.p: C = None
        self.o: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: B = None
        self.q: B = None
        self.t: C = None
        self.txt = txt

e = A("e")
d = B("d")
i = C("i")
f = D("f")
n = A("n")
g = B("g")
j = A("j")
k = D("k")

e.x = i
e.p = i
e.r = n
e.o = j
d.u = k
d.v = k
d.s = g
d.z = i
i.q = n
f.w = k
f.p = d
f.q = d
f.t = i
n.x = i
n.p = i
n.r = e
n.o = j
g.u = k
g.v = f
g.s = d
g.z = i
j.x = i
j.p = i
j.r = n
j.o = e
k.w = f
k.p = d
k.q = d
k.t = i
assert j.r.p.q.o.o.txt == "e"