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

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

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

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

n = A("n")
j = B("j")
f = C("f")
m = D("m")

n.x = j
n.q = j
n.o = j
n.u = j
j.t = n
f.v = m
m.y = j
assert f.v.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: B = None
        self.o: B = None
        self.u: B = None
        self.txt = txt

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

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

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

n = A("n")
j = B("j")
f = C("f")
m = D("m")

n.x = j
n.q = j
n.o = j
n.u = j
j.t = n
f.v = m
m.y = j
assert f.v.y.t.txt == "n"