class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: F = None
        self.z: B = None
        self.s: F = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

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

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

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