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

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

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

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

m = A("m")
i = B("i")
j = C("j")
k = D("k")
c = C("c")
n = A("n")

m.q = k
m.u = i
m.t = c
i.p = m
j.z = k
j.y = n
k.v = j
k.t = c
k.o = i
c.z = k
c.y = n
n.q = k
n.u = i
n.t = c
assert i.p.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: B = None
        self.t: C = None
        self.txt = txt

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

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

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

m = A("m")
i = B("i")
j = C("j")
k = D("k")
c = C("c")
n = A("n")

m.q = k
m.u = i
m.t = c
i.p = m
j.z = k
j.y = n
k.v = j
k.t = c
k.o = i
c.z = k
c.y = n
n.q = k
n.u = i
n.t = c
assert i.p.u.p.txt == "m"