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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: A = None
        self.v: B = None
        self.w: A = None
        self.txt = txt

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

h = A("h")
k = B("k")
f = C("f")
i = D("i")
b = E("b")
j = F("j")
a = D("a")

h.z = a
k.x = a
f.x = k
i.p = h
i.s = h
i.r = f
i.o = j
i.w = j
b.t = f
b.u = h
b.w = h
b.v = k
j.u = b
j.t = a
a.p = h
a.s = h
a.r = f
a.o = j
a.w = j
assert b.v.x.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: A = None
        self.v: B = None
        self.w: A = None
        self.txt = txt

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

h = A("h")
k = B("k")
f = C("f")
i = D("i")
b = E("b")
j = F("j")
a = D("a")

h.z = a
k.x = a
f.x = k
i.p = h
i.s = h
i.r = f
i.o = j
i.w = j
b.t = f
b.u = h
b.w = h
b.v = k
j.u = b
j.t = a
a.p = h
a.s = h
a.r = f
a.o = j
a.w = j
assert b.v.x.r.x.txt == "k"