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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: C = None
        self.q: A = None
        self.y: E = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

i.o = m
j.u = f
j.x = f
j.q = i
j.y = b
j.p = n
f.y = m
f.w = i
n.t = b
n.w = b
n.s = i
b.s = f
b.o = i
m.w = i
m.r = f
h.t = b
h.w = b
h.s = i
assert m.r.y.w.o.r.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: C = None
        self.q: A = None
        self.y: E = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

i.o = m
j.u = f
j.x = f
j.q = i
j.y = b
j.p = n
f.y = m
f.w = i
n.t = b
n.w = b
n.s = i
b.s = f
b.o = i
m.w = i
m.r = f
h.t = b
h.w = b
h.s = i
assert m.r.y.w.o.r.w.o.txt == "m"