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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: D = None
        self.u: E = None
        self.txt = txt

k = A("k")
f = B("f")
n = C("n")
h = D("h")
m = E("m")
e = F("e")

k.v = h
k.o = h
f.s = m
f.p = h
f.w = h
n.x = h
h.u = k
h.y = f
h.r = e
m.w = h
m.p = h
m.v = k
e.o = f
e.s = h
e.u = m
assert m.v.v.u.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.o: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: D = None
        self.u: E = None
        self.txt = txt

k = A("k")
f = B("f")
n = C("n")
h = D("h")
m = E("m")
e = F("e")

k.v = h
k.o = h
f.s = m
f.p = h
f.w = h
n.x = h
h.u = k
h.y = f
h.r = e
m.w = h
m.p = h
m.v = k
e.o = f
e.s = h
e.u = m
assert m.v.v.u.o.u.txt == "k"