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

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

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

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

c = A("c")
d = B("d")
l = C("l")
i = D("i")
g = D("g")
f = D("f")
b = A("b")
m = C("m")

c.w = i
d.r = i
l.t = g
l.u = g
l.q = f
l.o = b
i.x = g
i.r = g
i.w = l
g.x = f
g.r = i
g.w = l
f.x = g
f.r = g
f.w = m
b.w = g
m.t = f
m.u = f
m.q = i
m.o = c
assert g.x.w.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

c = A("c")
d = B("d")
l = C("l")
i = D("i")
g = D("g")
f = D("f")
b = A("b")
m = C("m")

c.w = i
d.r = i
l.t = g
l.u = g
l.q = f
l.o = b
i.x = g
i.r = g
i.w = l
g.x = f
g.r = i
g.w = l
f.x = g
f.r = g
f.w = m
b.w = g
m.t = f
m.u = f
m.q = i
m.o = c
assert g.x.w.t.w.txt == "m"