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

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

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

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

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

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

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

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

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

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

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

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

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

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

h.x = j
h.r = j
h.u = k
k.p = h
k.x = n
k.y = j
k.s = m
k.v = b
n.o = b
b.w = k
b.t = k
b.r = k
m.p = n
j.u = m
j.w = h
j.t = n
j.p = b
j.r = b
assert m.p.o.w.p.u.txt == "k"