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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: D = None
        self.o: D = None
        self.s: D = None
        self.r: A = None
        self.q: F = None
        self.txt = txt

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

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

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

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

g = A("g")
d = B("d")
j = C("j")
l = D("l")
h = E("h")
f = F("f")
m = D("m")
c = F("c")

g.w = m
g.u = j
g.r = c
d.y = h
d.p = m
d.s = m
d.o = l
d.r = g
d.q = c
j.v = c
l.q = j
l.p = g
l.v = d
l.y = d
h.r = j
h.z = j
h.o = j
h.v = d
f.p = g
m.q = j
m.p = g
m.v = d
m.y = d
c.p = g
assert g.u.v.p.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.u: C = None
        self.r: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: D = None
        self.o: D = None
        self.s: D = None
        self.r: A = None
        self.q: F = None
        self.txt = txt

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

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

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

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

g = A("g")
d = B("d")
j = C("j")
l = D("l")
h = E("h")
f = F("f")
m = D("m")
c = F("c")

g.w = m
g.u = j
g.r = c
d.y = h
d.p = m
d.s = m
d.o = l
d.r = g
d.q = c
j.v = c
l.q = j
l.p = g
l.v = d
l.y = d
h.r = j
h.z = j
h.o = j
h.v = d
f.p = g
m.q = j
m.p = g
m.v = d
m.y = d
c.p = g
assert g.u.v.p.u.v.txt == "c"