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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.r: F = None
        self.w: A = None
        self.t: D = None
        self.p: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: B = None
        self.p: A = None
        self.txt = txt

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

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

m = A("m")
n = B("n")
h = C("h")
b = D("b")
c = E("c")
f = F("f")
l = C("l")

m.x = n
m.v = c
n.q = b
n.t = b
n.r = f
n.w = m
n.p = m
h.t = c
h.v = m
h.r = b
h.w = b
h.x = b
b.v = n
b.t = n
b.p = m
c.r = f
f.o = l
l.t = c
l.v = m
l.r = b
l.w = b
l.x = b
assert m.x.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.r: F = None
        self.w: A = None
        self.t: D = None
        self.p: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: B = None
        self.p: A = None
        self.txt = txt

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

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

m = A("m")
n = B("n")
h = C("h")
b = D("b")
c = E("c")
f = F("f")
l = C("l")

m.x = n
m.v = c
n.q = b
n.t = b
n.r = f
n.w = m
n.p = m
h.t = c
h.v = m
h.r = b
h.w = b
h.x = b
b.v = n
b.t = n
b.p = m
c.r = f
f.o = l
l.t = c
l.v = m
l.r = b
l.w = b
l.x = b
assert m.x.r.o.txt == "l"