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

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

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

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

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

m = A("m")
b = B("b")
c = C("c")
h = D("h")
g = E("g")
k = A("k")
f = B("f")
j = D("j")

m.p = c
m.v = g
m.r = g
m.z = h
m.x = k
b.y = g
b.x = g
c.x = k
h.q = f
h.y = k
g.x = m
g.o = m
g.v = j
k.p = c
k.v = g
k.r = g
k.z = h
k.x = m
f.y = g
f.x = g
j.q = f
j.y = k
assert j.y.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: E = None
        self.z: D = None
        self.x: A = None
        self.r: E = None
        self.txt = txt

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

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

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

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

m = A("m")
b = B("b")
c = C("c")
h = D("h")
g = E("g")
k = A("k")
f = B("f")
j = D("j")

m.p = c
m.v = g
m.r = g
m.z = h
m.x = k
b.y = g
b.x = g
c.x = k
h.q = f
h.y = k
g.x = m
g.o = m
g.v = j
k.p = c
k.v = g
k.r = g
k.z = h
k.x = m
f.y = g
f.x = g
j.q = f
j.y = k
assert j.y.p.x.txt == "k"