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

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

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

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

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

i.t = m
i.r = g
i.o = n
g.y = n
j.x = m
n.p = g
n.v = i
n.t = i
n.u = m
m.p = g
m.v = i
m.t = i
m.u = n
assert i.t.t.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: B = None
        self.o: D = None
        self.txt = txt

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

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

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

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

i.t = m
i.r = g
i.o = n
g.y = n
j.x = m
n.p = g
n.v = i
n.t = i
n.u = m
m.p = g
m.v = i
m.t = i
m.u = n
assert i.t.t.r.y.txt == "n"