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

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

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

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

a = A("a")
g = B("g")
n = C("n")
b = D("b")
m = C("m")

a.o = g
a.r = n
a.w = b
a.u = m
g.x = a
g.r = a
g.o = n
g.s = b
n.q = g
n.t = g
n.u = b
b.v = g
b.x = n
b.o = n
b.t = m
m.q = g
m.t = g
m.u = b
assert n.u.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: C = None
        self.w: D = None
        self.u: C = None
        self.txt = txt

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

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

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

a = A("a")
g = B("g")
n = C("n")
b = D("b")
m = C("m")

a.o = g
a.r = n
a.w = b
a.u = m
g.x = a
g.r = a
g.o = n
g.s = b
n.q = g
n.t = g
n.u = b
b.v = g
b.x = n
b.o = n
b.t = m
m.q = g
m.t = g
m.u = b
assert n.u.t.t.txt == "g"