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

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

h = A("h")
m = B("m")
g = C("g")
b = D("b")
f = B("f")
a = A("a")
j = D("j")

h.s = g
h.v = g
h.t = m
h.x = b
m.y = f
m.o = g
g.x = b
b.s = j
b.z = a
b.x = g
f.y = m
f.o = g
a.s = g
a.v = g
a.t = m
a.x = b
j.s = b
j.z = a
j.x = g
assert f.o.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: C = None
        self.t: B = None
        self.x: D = None
        self.txt = txt

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

h = A("h")
m = B("m")
g = C("g")
b = D("b")
f = B("f")
a = A("a")
j = D("j")

h.s = g
h.v = g
h.t = m
h.x = b
m.y = f
m.o = g
g.x = b
b.s = j
b.z = a
b.x = g
f.y = m
f.o = g
a.s = g
a.v = g
a.t = m
a.x = b
j.s = b
j.z = a
j.x = g
assert f.o.x.x.x.x.x.txt == "b"