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

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

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: B = None
        self.q: B = None
        self.r: B = None
        self.txt = txt

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

g = A("g")
d = B("d")
n = C("n")
i = D("i")
a = E("a")
j = F("j")
f = D("f")

g.x = d
d.y = n
n.r = j
i.p = n
i.x = d
i.w = d
i.y = a
i.o = a
i.s = a
a.s = g
a.v = d
a.q = d
a.r = d
j.q = a
f.p = n
f.x = d
f.w = d
f.y = a
f.o = a
f.s = a
assert a.s.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: B = None
        self.q: B = None
        self.r: B = None
        self.txt = txt

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

g = A("g")
d = B("d")
n = C("n")
i = D("i")
a = E("a")
j = F("j")
f = D("f")

g.x = d
d.y = n
n.r = j
i.p = n
i.x = d
i.w = d
i.y = a
i.o = a
i.s = a
a.s = g
a.v = d
a.q = d
a.r = d
j.q = a
f.p = n
f.x = d
f.w = d
f.y = a
f.o = a
f.s = a
assert a.s.x.y.txt == "n"