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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: B = None
        self.t: A = None
        self.v: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

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

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

f = A("f")
j = B("j")
h = C("h")
d = D("d")
e = E("e")
n = F("n")

f.u = h
f.p = d
f.v = e
j.y = f
h.y = j
h.q = j
h.t = f
h.v = n
d.w = n
e.u = n
e.s = n
e.x = j
e.r = d
e.t = d
n.w = j
n.r = d
n.o = e
assert f.p.w.w.y.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: D = None
        self.v: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: B = None
        self.t: A = None
        self.v: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

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

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

f = A("f")
j = B("j")
h = C("h")
d = D("d")
e = E("e")
n = F("n")

f.u = h
f.p = d
f.v = e
j.y = f
h.y = j
h.q = j
h.t = f
h.v = n
d.w = n
e.u = n
e.s = n
e.x = j
e.r = d
e.t = d
n.w = j
n.r = d
n.o = e
assert f.p.w.w.y.v.s.txt == "n"