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

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

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

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

b = A("b")
a = B("a")
f = C("f")
c = D("c")
h = D("h")
n = C("n")

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

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

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

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

b = A("b")
a = B("a")
f = C("f")
c = D("c")
h = D("h")
n = C("n")

b.x = n
b.w = c
b.s = h
a.t = n
f.q = h
f.t = h
c.v = a
c.y = f
c.o = f
c.x = n
h.v = a
h.y = n
h.x = f
h.o = f
n.q = h
n.t = h
assert n.q.o.q.x.q.x.txt == "f"