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

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

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

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

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

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

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

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

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

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

a.o = h
a.t = h
a.x = m
c.o = a
f.s = g
h.r = m
h.y = a
h.v = c
g.o = h
g.t = h
g.x = m
m.s = g
assert c.o.x.s.x.s.t.txt == "h"