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

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

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

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

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

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

d = A("d")
b = B("b")
g = C("g")
h = D("h")
k = E("k")
j = F("j")
a = A("a")
l = C("l")

d.y = a
d.r = a
d.p = a
d.w = j
b.v = h
b.q = g
b.r = k
b.w = k
g.q = h
g.z = h
h.p = g
h.x = k
h.u = a
h.v = l
h.o = j
h.s = j
k.r = h
k.w = l
j.r = h
a.y = d
a.r = d
a.p = d
a.w = j
l.q = h
l.z = h
assert a.p.w.r.p.z.p.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: A = None
        self.w: F = None
        self.p: A = None
        self.txt = txt

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

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

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

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

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

d = A("d")
b = B("b")
g = C("g")
h = D("h")
k = E("k")
j = F("j")
a = A("a")
l = C("l")

d.y = a
d.r = a
d.p = a
d.w = j
b.v = h
b.q = g
b.r = k
b.w = k
g.q = h
g.z = h
h.p = g
h.x = k
h.u = a
h.v = l
h.o = j
h.s = j
k.r = h
k.w = l
j.r = h
a.y = d
a.r = d
a.p = d
a.w = j
l.q = h
l.z = h
assert a.p.w.r.p.z.p.z.v.txt == "l"