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

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

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

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

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

i.t = n
i.v = a
i.o = a
i.r = g
g.q = a
j.v = g
j.x = n
j.s = a
j.o = d
d.v = i
d.r = i
m.q = i
f.v = m
f.x = n
f.o = n
f.s = i
n.v = i
n.r = i
a.t = n
a.v = i
a.o = i
a.r = g
assert j.x.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: A = None
        self.r: B = None
        self.o: A = None
        self.txt = txt

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

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

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

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

i.t = n
i.v = a
i.o = a
i.r = g
g.q = a
j.v = g
j.x = n
j.s = a
j.o = d
d.v = i
d.r = i
m.q = i
f.v = m
f.x = n
f.o = n
f.s = i
n.v = i
n.r = i
a.t = n
a.v = i
a.o = i
a.r = g
assert j.x.v.o.txt == "a"