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

class B:
    def __init__(self, txt: str):
        self.o: B = 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.t: A = None
        self.y: C = None
        self.txt = txt

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

n.y = a
n.r = c
n.u = g
j.o = b
c.x = a
m.t = d
m.y = a
d.y = a
d.r = a
d.u = g
g.y = a
g.r = a
g.u = d
f.t = g
f.y = c
a.x = c
b.o = j
assert m.t.y.x.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: C = None
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: B = 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.t: A = None
        self.y: C = None
        self.txt = txt

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

n.y = a
n.r = c
n.u = g
j.o = b
c.x = a
m.t = d
m.y = a
d.y = a
d.r = a
d.u = g
g.y = a
g.r = a
g.u = d
f.t = g
f.y = c
a.x = c
b.o = j
assert m.t.y.x.x.x.x.x.x.txt == "a"