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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

b = A("b")
c = B("c")
m = C("m")
d = D("d")
i = E("i")
h = F("h")

b.s = c
b.w = c
b.z = d
b.x = i
b.o = h
c.u = d
c.p = i
m.t = i
d.y = h
i.s = h
i.y = b
h.w = b
h.x = m
h.r = c
assert i.y.s.p.y.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: D = None
        self.x: E = None
        self.w: B = None
        self.o: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

b = A("b")
c = B("c")
m = C("m")
d = D("d")
i = E("i")
h = F("h")

b.s = c
b.w = c
b.z = d
b.x = i
b.o = h
c.u = d
c.p = i
m.t = i
d.y = h
i.s = h
i.y = b
h.w = b
h.x = m
h.r = c
assert i.y.s.p.y.x.s.txt == "h"