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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

a = A("a")
m = B("m")
g = C("g")
b = D("b")
k = E("k")
f = E("f")
c = D("c")
j = D("j")

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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

a = A("a")
m = B("m")
g = C("g")
b = D("b")
k = E("k")
f = E("f")
c = D("c")
j = D("j")

a.t = g
m.w = a
g.y = k
b.w = a
b.t = m
b.x = m
b.o = c
k.x = f
f.x = k
c.w = a
c.t = m
c.x = m
c.o = j
j.w = a
j.t = m
j.x = m
j.o = c
assert c.o.x.w.txt == "a"