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

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

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

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

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

i.z = e
i.q = f
i.y = n
j.t = g
j.p = g
j.y = f
n.r = e
e.x = n
e.r = i
e.y = i
e.s = k
g.t = f
g.y = f
g.p = j
k.x = n
k.r = i
k.y = i
k.s = e
f.t = j
f.y = j
f.p = g
assert n.r.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: B = None
        self.y: C = None
        self.txt = txt

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

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

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

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

i.z = e
i.q = f
i.y = n
j.t = g
j.p = g
j.y = f
n.r = e
e.x = n
e.r = i
e.y = i
e.s = k
g.t = f
g.y = f
g.p = j
k.x = n
k.r = i
k.y = i
k.s = e
f.t = j
f.y = j
f.p = g
assert n.r.x.r.txt == "e"