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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.x: C = None
        self.u: C = None
        self.s: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: B = None
        self.s: A = None
        self.u: D = None
        self.v: B = None
        self.txt = txt

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

i = A("i")
b = B("b")
h = C("h")
a = D("a")
e = E("e")
g = F("g")

i.o = h
i.r = h
i.x = a
b.o = e
b.x = h
b.u = h
b.s = h
h.w = b
a.z = g
a.p = g
a.v = i
a.o = b
a.x = b
e.t = h
e.r = b
e.v = b
e.s = i
e.u = a
g.x = e
g.v = h
g.w = a
assert a.o.s.w.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: D = None
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.x: C = None
        self.u: C = None
        self.s: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: B = None
        self.s: A = None
        self.u: D = None
        self.v: B = None
        self.txt = txt

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

i = A("i")
b = B("b")
h = C("h")
a = D("a")
e = E("e")
g = F("g")

i.o = h
i.r = h
i.x = a
b.o = e
b.x = h
b.u = h
b.s = h
h.w = b
a.z = g
a.p = g
a.v = i
a.o = b
a.x = b
e.t = h
e.r = b
e.v = b
e.s = i
e.u = a
g.x = e
g.v = h
g.w = a
assert a.o.s.w.s.w.txt == "b"