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

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

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

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

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

f.t = k
f.v = d
f.q = g
f.u = i
k.p = g
k.x = i
k.t = i
g.p = d
i.z = d
i.u = f
i.q = f
i.p = g
d.t = k
d.v = f
d.q = g
d.u = i
assert d.u.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: A = None
        self.q: C = None
        self.u: D = None
        self.txt = txt

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

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

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

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

f.t = k
f.v = d
f.q = g
f.u = i
k.p = g
k.x = i
k.t = i
g.p = d
i.z = d
i.u = f
i.q = f
i.p = g
d.t = k
d.v = f
d.q = g
d.u = i
assert d.u.u.q.txt == "g"