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

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

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

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

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

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

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

m.x = l
m.p = b
g.x = b
g.v = b
g.o = f
g.s = m
f.o = b
f.v = b
f.r = l
f.s = g
f.t = i
b.o = f
b.x = g
i.y = f
i.x = l
l.t = f
l.v = i
l.r = h
h.y = f
h.x = l
assert i.y.t.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

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

m.x = l
m.p = b
g.x = b
g.v = b
g.o = f
g.s = m
f.o = b
f.v = b
f.r = l
f.s = g
f.t = i
b.o = f
b.x = g
i.y = f
i.x = l
l.t = f
l.v = i
l.r = h
h.y = f
h.x = l
assert i.y.t.x.t.txt == "f"