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

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

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

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

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

c.u = l
c.t = l
c.y = m
c.q = j
j.q = m
j.y = m
j.r = m
j.t = c
l.x = n
m.w = n
m.v = l
m.r = c
n.x = l
assert j.t.t.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: D = None
        self.t: C = None
        self.q: B = None
        self.txt = txt

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

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

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

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

c.u = l
c.t = l
c.y = m
c.q = j
j.q = m
j.y = m
j.r = m
j.t = c
l.x = n
m.w = n
m.v = l
m.r = c
n.x = l
assert j.t.t.x.x.x.txt == "n"