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

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

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

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

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

m.s = e
m.t = e
j.w = g
j.o = m
j.s = f
f.s = m
f.u = m
f.w = c
f.v = c
h.o = m
h.s = j
e.s = m
e.u = m
e.w = h
e.v = h
c.o = m
c.s = g
g.w = j
g.o = m
g.s = e
assert c.s.s.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: C = None
        self.txt = txt

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

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

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

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

m.s = e
m.t = e
j.w = g
j.o = m
j.s = f
f.s = m
f.u = m
f.w = c
f.v = c
h.o = m
h.s = j
e.s = m
e.u = m
e.w = h
e.v = h
c.o = m
c.s = g
g.w = j
g.o = m
g.s = e
assert c.s.s.s.t.txt == "e"