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

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

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

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

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

f.q = c
f.w = i
f.z = g
i.u = c
i.y = g
i.v = j
e.u = i
e.r = f
e.w = f
e.s = f
c.p = f
c.y = i
c.r = g
j.u = i
j.r = f
j.w = f
j.s = f
g.p = f
g.y = i
g.r = c
assert g.r.p.z.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: B = None
        self.z: D = None
        self.txt = txt

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

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

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

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

f.q = c
f.w = i
f.z = g
i.u = c
i.y = g
i.v = j
e.u = i
e.r = f
e.w = f
e.s = f
c.p = f
c.y = i
c.r = g
j.u = i
j.r = f
j.w = f
j.s = f
g.p = f
g.y = i
g.r = c
assert g.r.p.z.r.y.txt == "i"