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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

k = A("k")
c = B("c")
h = C("h")
d = D("d")
m = E("m")
j = F("j")

k.y = d
k.p = d
c.z = d
h.v = j
h.p = c
d.y = k
d.x = m
m.q = d
j.v = c
j.y = h
j.u = h
j.z = m
j.o = d
j.s = k
assert j.s.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.p: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

k = A("k")
c = B("c")
h = C("h")
d = D("d")
m = E("m")
j = F("j")

k.y = d
k.p = d
c.z = d
h.v = j
h.p = c
d.y = k
d.x = m
m.q = d
j.v = c
j.y = h
j.u = h
j.z = m
j.o = d
j.s = k
assert j.s.y.x.txt == "m"