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

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

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

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

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

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

h = A("h")
a = B("a")
l = C("l")
n = D("n")
m = E("m")
j = F("j")
b = C("b")

h.u = l
h.w = l
h.v = n
h.q = j
h.x = m
a.p = m
l.v = j
n.p = h
m.u = l
j.v = a
j.o = b
j.x = n
j.w = m
j.p = h
b.v = j
assert b.v.v.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.v: D = None
        self.q: F = None
        self.x: E = None
        self.w: C = None
        self.txt = txt

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

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

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

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

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

h = A("h")
a = B("a")
l = C("l")
n = D("n")
m = E("m")
j = F("j")
b = C("b")

h.u = l
h.w = l
h.v = n
h.q = j
h.x = m
a.p = m
l.v = j
n.p = h
m.u = l
j.v = a
j.o = b
j.x = n
j.w = m
j.p = h
b.v = j
assert b.v.v.p.u.txt == "l"