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

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.v: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

g.z = k
g.s = h
a.x = j
a.v = h
f.t = h
i.o = b
i.u = b
i.r = b
i.w = f
k.w = f
m.o = f
j.o = f
b.o = i
b.u = i
b.r = i
b.w = f
h.z = k
h.s = g
assert b.w.t.z.w.t.s.z.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.s: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.v: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

g.z = k
g.s = h
a.x = j
a.v = h
f.t = h
i.o = b
i.u = b
i.r = b
i.w = f
k.w = f
m.o = f
j.o = f
b.o = i
b.u = i
b.r = i
b.w = f
h.z = k
h.s = g
assert b.w.t.z.w.t.s.z.w.t.txt == "h"