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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: C = None
        self.t: B = None
        self.p: B = None
        self.txt = txt

c = A("c")
g = B("g")
h = C("h")
j = D("j")
e = A("e")
b = C("b")
a = A("a")
l = B("l")
k = C("k")
i = B("i")

c.p = b
c.v = b
c.x = e
c.o = e
g.w = i
g.x = i
g.y = k
h.r = j
h.t = j
h.p = k
j.r = k
j.x = b
j.t = g
j.p = l
e.p = k
e.x = c
e.o = c
e.v = h
b.r = j
b.t = j
b.p = k
a.p = k
a.x = c
a.v = h
a.o = e
l.w = g
l.x = g
l.y = b
k.r = j
k.t = j
k.p = b
i.w = g
i.x = g
i.y = b
assert g.x.x.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: A = None
        self.v: C = None
        self.o: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: C = None
        self.t: B = None
        self.p: B = None
        self.txt = txt

c = A("c")
g = B("g")
h = C("h")
j = D("j")
e = A("e")
b = C("b")
a = A("a")
l = B("l")
k = C("k")
i = B("i")

c.p = b
c.v = b
c.x = e
c.o = e
g.w = i
g.x = i
g.y = k
h.r = j
h.t = j
h.p = k
j.r = k
j.x = b
j.t = g
j.p = l
e.p = k
e.x = c
e.o = c
e.v = h
b.r = j
b.t = j
b.p = k
a.p = k
a.x = c
a.v = h
a.o = e
l.w = g
l.x = g
l.y = b
k.r = j
k.t = j
k.p = b
i.w = g
i.x = g
i.y = b
assert g.x.x.y.p.txt == "b"